const App = {
    mixins: [Save],//配置文件，路径/utils/mixins.js
    data() {
        return {
            CC: [],
            CCvalue: [],
        };
    },
    mounted() {
        this.getCC();
    },
    watch: {
        'dataForm.Offspring_Seed_SerialNumber'(val) {
            if (this.CC.length > 0) {
                this.isCCvalue();
            }
        },
        CC() {
            if (this.dataForm.Offspring_Seed_SerialNumber) {
                this.isCCvalue();
            }
        }
    },
    methods: {
        getCC() {
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryForObtainingTrees`,
                type: "GET",
                data: {
                    TableName: 'offspring_seed_category',
                    NodeCode: '',
                },
                success: (data) => {
                    this.CC = data.filter(i => i.children); // 直接使用 this
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json",
            });
        },
        changeCC(val) {
            if (val.length > 0) {
                this.dataForm.Offspring_Seed_Category_SerialNumber = val[val.length - 1]
            } else {
                this.dataForm.Offspring_Seed_Category_SerialNumber = '';
            }
        },
        isCCvalue() {
            this.CC.forEach(item => {
                item.children.forEach(ite => {
                    if (ite.Offspring_Seed_Category_SerialNumber == this.dataForm.Offspring_Seed_Category_SerialNumber) {
                        this.CCvalue = [item.Offspring_Seed_Category_SerialNumber, ite.Offspring_Seed_Category_SerialNumber];
                    }
                })
            })
        }
    },
};
const { createApp, ref } = Vue;
const app = createApp(App);
app.use(ElementPlus, { locale: zhCn });
//这种方式是引入全部图标，无需单个引入
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}
const ElMessage = ElementPlus.ElMessage;
app.mount("#app");
